package com.aaa.hospital.ManagementEnd.service.Impl;

import com.aaa.hospital.ManagementEnd.mapper.MedChargeDao;
import com.aaa.hospital.ManagementEnd.pojo.DrugGathering;
import com.aaa.hospital.ManagementEnd.pojo.VisitingCard;
import com.aaa.hospital.ManagementEnd.service.MedChargeSerevice;
import com.aaa.hospital.ManagementEnd.util.MecharDB;
import com.aaa.hospital.ManagementEnd.util.MedicineCharge;
import com.sun.org.apache.bcel.internal.generic.IFNE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MedChargeSereviceImpl implements MedChargeSerevice {

    @Autowired
  private MedChargeDao medChargeDao;



    @Override
    public List<MedicineCharge> MedChargeAll(Integer diaid) {
        return medChargeDao.MedChargeAll(diaid);
    }

    @Override
    public boolean dginsert(DrugGathering drugGathering) {
        return medChargeDao.dginsert(drugGathering);
    }

    @Override
    public boolean Byvisid(Integer visid, Integer price) {
        VisitingCard byvisid = medChargeDao.Byvisid(visid);
        Integer balance = byvisid.getBalance();
        if (balance < price) {
            return false;
        } else {
            return medChargeDao.visprice(visid, price);
        }
    }

    @Override
    public boolean ydstate(Integer diaid) {
        return medChargeDao.ydstate(diaid);
    }

    @Override
    public List<MecharDB> queryList() {
        return medChargeDao.queryList();
    }

    @Override
    public List<MedicineCharge> queryListById(Integer diaid) {
        return medChargeDao.queryListById(diaid);
    }

    @Override
    public List<MecharDB> queryListlimit(String name) {
        return medChargeDao.queryListlimit(name);
    }

    @Override
    public boolean visprice(Integer visid, Integer price) {
        return medChargeDao.visprice(visid,price);
    }
}
